{% load bootstrap4 i18n static %}

{% get_current_language as language_code %}

<!DOCTYPE html>
<html lang="{{ language_code }}">
<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="An example of Django project with basic user functionality.">
    <meta name="author" content="Yehor Smoliakov">

    <link rel="icon" href="{% static 'favicon.ico' %}">

    <title>Simple Django Login and Registration</title>

    <link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/styles.css' %}" rel="stylesheet">

</head>

<body>

<nav class="navbar navbar-expand-md navbar-dark bg-dark static-top">

    <a class="navbar-brand" href="{% url 'index' %}">{% translate 'Home' %}</a>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarsExampleDefault">
        <ul class="navbar-nav mr-auto">
            {% if request.user.is_authenticated %}
                {% if request.user.is_superuser %}
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'admin:login' %}">{% translate 'Django administration' %}</a>
                    </li>
                {% endif %}
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:change_password' %}">{% translate 'Change password' %}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:change_profile' %}">{% translate 'Change profile' %}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:change_email' %}">{% translate 'Change email' %}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:log_out_confirm' %}">{% translate 'Log out' %}</a>
                </li>
            {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:log_in' %}">{% translate 'Log in' %}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:sign_up' %}">{% translate 'Create an account' %}</a>
                </li>
            {% endif %}
        </ul>

        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="{% url 'change_language' %}">{% translate 'Change language' %}</a>
            </li>
        </ul>
    </div>

</nav>

<div class="container-fluid mt-3">

    {% bootstrap_messages %}

    {% block content %}
        No content.
    {% endblock content %}

</div>

<script src="{% static 'vendor/jquery/jquery-3.4.1.min.js' %}"></script>
<script src="{% static 'vendor/popper/popper.min.js' %}"></script>
<script src="{% static 'vendor/bootstrap/js/bootstrap.min.js' %}"></script>

<script src="{% static 'js/ie10-viewport-bug-workaround.js' %}"></script>

</body>
</html>
